package org.gap.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import java.util.Calendar;
import java.util.LinkedHashSet;
import java.util.Set;

import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */

@Entity
@NamedQueries({
		@NamedQuery(name = "findAllTierss", query = "select myTiers from Tiers myTiers"),
		@NamedQuery(name = "findTiersByPrimaryKey", query = "select myTiers from Tiers myTiers where myTiers.tieTiers = ?1"),
		@NamedQuery(name = "findTiersByTieDateCreation", query = "select myTiers from Tiers myTiers where myTiers.tieDateCreation = ?1"),
		@NamedQuery(name = "findTiersByTieDateCreationAfter", query = "select myTiers from Tiers myTiers where myTiers.tieDateCreation > ?1"),
		@NamedQuery(name = "findTiersByTieDateCreationBefore", query = "select myTiers from Tiers myTiers where myTiers.tieDateCreation < ?1"),
		@NamedQuery(name = "findTiersByTieEMail", query = "select myTiers from Tiers myTiers where myTiers.tieEMail = ?1"),
		@NamedQuery(name = "findTiersByTieEMailContaining", query = "select myTiers from Tiers myTiers where myTiers.tieEMail like ?1"),
		@NamedQuery(name = "findTiersByTieFax", query = "select myTiers from Tiers myTiers where myTiers.tieFax = ?1"),
		@NamedQuery(name = "findTiersByTieFaxContaining", query = "select myTiers from Tiers myTiers where myTiers.tieFax like ?1"),
		@NamedQuery(name = "findTiersByTieIdentClient", query = "select myTiers from Tiers myTiers where myTiers.tieIdentClient = ?1"),
		@NamedQuery(name = "findTiersByTieIdentClientContaining", query = "select myTiers from Tiers myTiers where myTiers.tieIdentClient like ?1"),
		@NamedQuery(name = "findTiersByTieLibExterne", query = "select myTiers from Tiers myTiers where myTiers.tieLibExterne = ?1"),
		@NamedQuery(name = "findTiersByTieLibExterneContaining", query = "select myTiers from Tiers myTiers where myTiers.tieLibExterne like ?1"),
		@NamedQuery(name = "findTiersByTieNationalite", query = "select myTiers from Tiers myTiers where myTiers.tieNationalite = ?1"),
		@NamedQuery(name = "findTiersByTieNationaliteContaining", query = "select myTiers from Tiers myTiers where myTiers.tieNationalite like ?1"),
		@NamedQuery(name = "findTiersByTieTelBureau", query = "select myTiers from Tiers myTiers where myTiers.tieTelBureau = ?1"),
		@NamedQuery(name = "findTiersByTieTelBureauContaining", query = "select myTiers from Tiers myTiers where myTiers.tieTelBureau like ?1"),
		@NamedQuery(name = "findTiersByTieTelFix", query = "select myTiers from Tiers myTiers where myTiers.tieTelFix = ?1"),
		@NamedQuery(name = "findTiersByTieTelFixContaining", query = "select myTiers from Tiers myTiers where myTiers.tieTelFix like ?1"),
		@NamedQuery(name = "findTiersByTieTelPortable", query = "select myTiers from Tiers myTiers where myTiers.tieTelPortable = ?1"),
		@NamedQuery(name = "findTiersByTieTelPortableContaining", query = "select myTiers from Tiers myTiers where myTiers.tieTelPortable like ?1"),
		@NamedQuery(name = "findTiersByTieTiers", query = "select myTiers from Tiers myTiers where myTiers.tieTiers = ?1"),
		@NamedQuery(name = "findTiersByTieTypeTiers", query = "select myTiers from Tiers myTiers where myTiers.tieTypeTiers = ?1"),
		@NamedQuery(name = "findTiersByTieTypeTiersContaining", query = "select myTiers from Tiers myTiers where myTiers.tieTypeTiers like ?1"),
		@NamedQuery(name = "findTiersByTieUserCreation", query = "select myTiers from Tiers myTiers where myTiers.tieUserCreation = ?1"),
		@NamedQuery(name = "findTiersByTieUserCreationContaining", query = "select myTiers from Tiers myTiers where myTiers.tieUserCreation like ?1"),
		
		})
		
@Table(schema = "GAP", name = "TIERS")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "GAP_v2/org/gap/domain", name = "Tiers")
@XmlRootElement(namespace = "GAP_v2/org/gap/domain")
public class Tiers implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "TIE_TIERS", nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	Integer tieTiers;
	/**
	 */

	@Column(name = "TIE_IDENT_CLIENT", length = 15)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String tieIdentClient;
	/**
	 */

	@Column(name = "TIE_TYPE_TIERS", length = 1)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String tieTypeTiers;
	/**
	 */

	@Column(name = "TIE_LIB_EXTERNE", length = 50)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String tieLibExterne;
	/**
	 */

	@Column(name = "TIE_NATIONALITE", length = 3)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String tieNationalite;
	/**
	 */

	@Column(name = "TIE_TEL_FIX", length = 12)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String tieTelFix;
	/**
	 */

	@Column(name = "TIE_TEL_BUREAU", length = 12)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String tieTelBureau;
	/**
	 */

	@Column(name = "TIE_TEL_PORTABLE", length = 12)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String tieTelPortable;
	/**
	 */

	@Column(name = "TIE_FAX", length = 12)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String tieFax;
	/**
	 */

	@Column(name = "TIE_E_MAIL", length = 60)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String tieEMail;
	/**
	 */
	@Temporal(TemporalType.DATE)
	@Column(name = "TIE_DATE_CREATION")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	Calendar tieDateCreation;
	/**
	 */

	@Column(name = "TIE_USER_CREATION", length = 10)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String tieUserCreation;

	/**
	 */
	@OneToMany(mappedBy = "tiersByRltTiersFils", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
	@XmlElement(name = "", namespace = "")
	java.util.Set<org.gap.domain.RelationsTiers> relationsTiersesForRltTiersParent;
	/**
	 */
	@OneToMany(mappedBy = "tiers", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
	@XmlElement(name = "", namespace = "")
	java.util.Set<org.gap.domain.Patient> patients;
	/**
	 */
	@OneToOne(mappedBy = "tiers", fetch = FetchType.LAZY)
	@XmlElement(name = "", namespace = "")
	CaractPP caractPP;
	/**
	 */
	@OneToMany(mappedBy = "tiers", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
	@XmlElement(name = "", namespace = "")
	java.util.Set<org.gap.domain.Adherent> adherents;
	/**
	 */
	@OneToMany(mappedBy = "tiers", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
	@XmlElement(name = "", namespace = "")
	java.util.Set<org.gap.domain.TiersModif> tiersModifs;
	/**
	 */
	@OneToMany(mappedBy = "tiers", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
	@XmlElement(name = "", namespace = "")
	java.util.Set<org.gap.domain.RolesTiers> rolesTierses;
	/**
	 */
	@OneToOne(mappedBy = "tiers", fetch = FetchType.LAZY)
	@XmlElement(name = "", namespace = "")
	CaractPM caractPM;
	/**
	 */
	@OneToMany(mappedBy = "tiersByRltTiersFils", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
	@XmlElement(name = "", namespace = "")
	java.util.Set<org.gap.domain.RelationsTiers> relationsTiersesForRltTiersFils;
	/**
	 */
	@OneToMany(mappedBy = "tiers", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
	@XmlElement(name = "", namespace = "")
	java.util.Set<org.gap.domain.Utilisateurs> utilisateurses;

	/**
	 */
	public void setTieTiers(Integer tieTiers) {
		this.tieTiers = tieTiers;
	}

	/**
	 */
	public Integer getTieTiers() {
		return this.tieTiers;
	}

	/**
	 */
	public void setTieIdentClient(String tieIdentClient) {
		this.tieIdentClient = tieIdentClient;
	}

	/**
	 */
	public String getTieIdentClient() {
		return this.tieIdentClient;
	}

	/**
	 */
	public void setTieTypeTiers(String tieTypeTiers) {
		this.tieTypeTiers = tieTypeTiers;
	}

	/**
	 */
	public String getTieTypeTiers() {
		return this.tieTypeTiers;
	}

	/**
	 */
	public void setTieLibExterne(String tieLibExterne) {
		this.tieLibExterne = tieLibExterne;
	}

	/**
	 */
	public String getTieLibExterne() {
		return this.tieLibExterne;
	}

	/**
	 */
	public void setTieNationalite(String tieNationalite) {
		this.tieNationalite = tieNationalite;
	}

	/**
	 */
	public String getTieNationalite() {
		return this.tieNationalite;
	}

	/**
	 */
	public void setTieTelFix(String tieTelFix) {
		this.tieTelFix = tieTelFix;
	}

	/**
	 */
	public String getTieTelFix() {
		return this.tieTelFix;
	}

	/**
	 */
	public void setTieTelBureau(String tieTelBureau) {
		this.tieTelBureau = tieTelBureau;
	}

	/**
	 */
	public String getTieTelBureau() {
		return this.tieTelBureau;
	}

	/**
	 */
	public void setTieTelPortable(String tieTelPortable) {
		this.tieTelPortable = tieTelPortable;
	}

	/**
	 */
	public String getTieTelPortable() {
		return this.tieTelPortable;
	}

	/**
	 */
	public void setTieFax(String tieFax) {
		this.tieFax = tieFax;
	}

	/**
	 */
	public String getTieFax() {
		return this.tieFax;
	}

	/**
	 */
	public void setTieEMail(String tieEMail) {
		this.tieEMail = tieEMail;
	}

	/**
	 */
	public String getTieEMail() {
		return this.tieEMail;
	}

	/**
	 */
	public void setTieDateCreation(Calendar tieDateCreation) {
		this.tieDateCreation = tieDateCreation;
	}

	/**
	 */
	public Calendar getTieDateCreation() {
		return this.tieDateCreation;
	}

	/**
	 */
	public void setTieUserCreation(String tieUserCreation) {
		this.tieUserCreation = tieUserCreation;
	}

	/**
	 */
	public String getTieUserCreation() {
		return this.tieUserCreation;
	}

	/**
	 */
	public void setRelationsTiersesForRltTiersParent(Set<RelationsTiers> relationsTiersesForRltTiersParent) {
		this.relationsTiersesForRltTiersParent = relationsTiersesForRltTiersParent;
	}

	/**
	 */
	public Set<RelationsTiers> getRelationsTiersesForRltTiersParent() {
		if (relationsTiersesForRltTiersParent == null) {
			relationsTiersesForRltTiersParent = new java.util.LinkedHashSet<org.gap.domain.RelationsTiers>();
		}
		return relationsTiersesForRltTiersParent;
	}

	/**
	 */
	public void setPatients(Set<Patient> patients) {
		this.patients = patients;
	}

	/**
	 */
	public Set<Patient> getPatients() {
		if (patients == null) {
			patients = new java.util.LinkedHashSet<org.gap.domain.Patient>();
		}
		return patients;
	}

	/**
	 */
	public void setCaractPP(CaractPP caractPP) {
		this.caractPP = caractPP;
	}

	/**
	 */
	public CaractPP getCaractPP() {
		return caractPP;
	}

	/**
	 */
	public void setAdherents(Set<Adherent> adherents) {
		this.adherents = adherents;
	}

	/**
	 */
	public Set<Adherent> getAdherents() {
		if (adherents == null) {
			adherents = new java.util.LinkedHashSet<org.gap.domain.Adherent>();
		}
		return adherents;
	}

	/**
	 */
	public void setTiersModifs(Set<TiersModif> tiersModifs) {
		this.tiersModifs = tiersModifs;
	}

	/**
	 */
	public Set<TiersModif> getTiersModifs() {
		if (tiersModifs == null) {
			tiersModifs = new java.util.LinkedHashSet<org.gap.domain.TiersModif>();
		}
		return tiersModifs;
	}

	/**
	 */
	public void setRolesTierses(Set<RolesTiers> rolesTierses) {
		this.rolesTierses = rolesTierses;
	}

	/**
	 */
	public Set<RolesTiers> getRolesTierses() {
		if (rolesTierses == null) {
			rolesTierses = new java.util.LinkedHashSet<org.gap.domain.RolesTiers>();
		}
		return rolesTierses;
	}

	/**
	 */
	public void setCaractPM(CaractPM caractPM) {
		this.caractPM = caractPM;
	}

	/**
	 */
	public CaractPM getCaractPM() {
		return caractPM;
	}

	/**
	 */
	public void setRelationsTiersesForRltTiersFils(Set<RelationsTiers> relationsTiersesForRltTiersFils) {
		this.relationsTiersesForRltTiersFils = relationsTiersesForRltTiersFils;
	}

	/**
	 */
	public Set<RelationsTiers> getRelationsTiersesForRltTiersFils() {
		if (relationsTiersesForRltTiersFils == null) {
			relationsTiersesForRltTiersFils = new java.util.LinkedHashSet<org.gap.domain.RelationsTiers>();
		}
		return relationsTiersesForRltTiersFils;
	}

	/**
	 */
	public void setUtilisateurses(Set<Utilisateurs> utilisateurses) {
		this.utilisateurses = utilisateurses;
	}

	/**
	 */
	public Set<Utilisateurs> getUtilisateurses() {
		if (utilisateurses == null) {
			utilisateurses = new java.util.LinkedHashSet<org.gap.domain.Utilisateurs>();
		}
		return utilisateurses;
	}

	/**
	 */
	public Tiers() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(Tiers that) {
		setTieTiers(that.getTieTiers());
		setTieIdentClient(that.getTieIdentClient());
		setTieTypeTiers(that.getTieTypeTiers());
		setTieLibExterne(that.getTieLibExterne());
		setTieNationalite(that.getTieNationalite());
		setTieTelFix(that.getTieTelFix());
		setTieTelBureau(that.getTieTelBureau());
		setTieTelPortable(that.getTieTelPortable());
		setTieFax(that.getTieFax());
		setTieEMail(that.getTieEMail());
		setTieDateCreation(that.getTieDateCreation());
		setTieUserCreation(that.getTieUserCreation());
		setRelationsTiersesForRltTiersParent(new java.util.LinkedHashSet<org.gap.domain.RelationsTiers>(that.getRelationsTiersesForRltTiersParent()));
		setPatients(new java.util.LinkedHashSet<org.gap.domain.Patient>(that.getPatients()));
		setCaractPP(that.getCaractPP());
		setAdherents(new java.util.LinkedHashSet<org.gap.domain.Adherent>(that.getAdherents()));
		setTiersModifs(new java.util.LinkedHashSet<org.gap.domain.TiersModif>(that.getTiersModifs()));
		setRolesTierses(new java.util.LinkedHashSet<org.gap.domain.RolesTiers>(that.getRolesTierses()));
		setCaractPM(that.getCaractPM());
		setRelationsTiersesForRltTiersFils(new java.util.LinkedHashSet<org.gap.domain.RelationsTiers>(that.getRelationsTiersesForRltTiersFils()));
		setUtilisateurses(new java.util.LinkedHashSet<org.gap.domain.Utilisateurs>(that.getUtilisateurses()));
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("tieTiers=[").append(tieTiers).append("] ");
		buffer.append("tieIdentClient=[").append(tieIdentClient).append("] ");
		buffer.append("tieTypeTiers=[").append(tieTypeTiers).append("] ");
		buffer.append("tieLibExterne=[").append(tieLibExterne).append("] ");
		buffer.append("tieNationalite=[").append(tieNationalite).append("] ");
		buffer.append("tieTelFix=[").append(tieTelFix).append("] ");
		buffer.append("tieTelBureau=[").append(tieTelBureau).append("] ");
		buffer.append("tieTelPortable=[").append(tieTelPortable).append("] ");
		buffer.append("tieFax=[").append(tieFax).append("] ");
		buffer.append("tieEMail=[").append(tieEMail).append("] ");
		buffer.append("tieDateCreation=[").append(tieDateCreation).append("] ");
		buffer.append("tieUserCreation=[").append(tieUserCreation).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((tieTiers == null) ? 0 : tieTiers.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof Tiers))
			return false;
		Tiers equalCheck = (Tiers) obj;
		if ((tieTiers == null && equalCheck.tieTiers != null) || (tieTiers != null && equalCheck.tieTiers == null))
			return false;
		if (tieTiers != null && !tieTiers.equals(equalCheck.tieTiers))
			return false;
		return true;
	}
}
